﻿<%@ Page Title="" Language="C#" StylesheetTheme="AdminTheme" MasterPageFile="~/Backend/mtpAdmin.master"
    AutoEventWireup="true" CodeFile="UserList.aspx.cs" Inherits="Backend_UserList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="dvTitleContent">
        Quản lý người dùng :: Danh sách người dùng</div>
    <fieldset>
        <legend>Danh sách người dùng</legend>

        <table>
            <tr>
                <td>
                    
                    Tìm kiếm bởi:
                    
                </td>
                <td>
                    
                    <asp:DropDownList ID="drdlSearch" runat="server">
                        <asp:ListItem>Username</asp:ListItem>
                        <asp:ListItem>Email</asp:ListItem>
                    </asp:DropDownList>
                    
                </td>
                <td>
                    
                    &nbsp;<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                    &nbsp;</td>
                <td>
                    
                    <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" 
                        Text="Tìm kiếm" />
                    
                </td>
            </tr>
        </table>

        <asp:Repeater ID="filteringUI" runat="server" OnItemCommand="filteringUI_ItemCommand">
            <ItemTemplate>
                <asp:LinkButton runat="server" ID="linkFilter" Text="<%# Container.DataItem %>" CommandName="<%# Container.DataItem %>"></asp:LinkButton>
            </ItemTemplate>
            <SeparatorTemplate>
                |
            </SeparatorTemplate>
        </asp:Repeater>
        <br />
        <br />
        <asp:GridView ID="grvUserList" runat="server" runat="server" AutoGenerateColumns="False"
            SkinID="tGridview" DataKeyNames="Username" OnSelectedIndexChanging="grvUserList_SelectedIndexChanging"
            AllowPaging="True" OnPageIndexChanging="grvUserList_PageIndexChanging" OnRowDeleting="grvUserList_RowDeleting">
            <Columns>
                <asp:BoundField DataField="Username" HeaderText="Username" />
                <asp:BoundField DataField="Email" HeaderText="Email" />
                <asp:CheckBoxField DataField="IsApproved" HeaderText="Approved">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:CheckBoxField DataField="isLockedOut" HeaderText="Locked Out?">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:CheckBoxField DataField="IsOnline" HeaderText="Online?">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:CommandField HeaderText="Manager" ShowSelectButton="True">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:CommandField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" runat="server" CommandArgument='<%# Eval("Username") %>'
                            CommandName="Delete" OnClientClick="return confirm('Bạn chắc chắn muốn xóa người dùng này không?');">Delete</asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
            </Columns>
            
        </asp:GridView>
    </fieldset>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <br />
    <asp:MultiView ID="mtvUserManager" runat="server">
        <asp:View ID="vwUserInformation" runat="server">
            <table width="100%">
                <tr>
                    <td width="35%" valign="top">
                        <fieldset>
                            <legend>Thông tin người dùng</legend>
                            <table cellpadding="0" cellspacing="0" style="width: 500px;">
                                <tr>
                                    <td class="style3" height="25">
                                        Tên đăng nhập:
                                    </td>
                                    <td height="25">
                                        <asp:Label ID="lblUsername" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3" height="25">
                                        Được phép đăng nhập:&nbsp;
                                    </td>
                                    <td height="25">
                                        <asp:CheckBox ID="chkIsApproved" runat="server" 
                                            OnCheckedChanged="chkIsApproved_CheckedChanged" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3" height="25">
                                        Email:</td>
                                    <td height="25">
                                        <asp:TextBox ID="txtEmail" runat="server" Width="200px"></asp:TextBox>
                                        &nbsp;<span class="style2">(*)</span></td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <span class="style2">(*)</span> Required field
                                        <br />
                                        <asp:Label ID="lblMessages" runat="server" ForeColor="Red"></asp:Label>
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Update" 
                                            Width="80px" />
                                        &nbsp;&nbsp;
                                        <asp:Button ID="btnDong" runat="server" onclick="btnDong_Click" Text="Đóng" 
                                            Width="80px" />
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                    <td width="65%" valign="top">
                        <fieldset>
                            <legend>Quyền quản trị </legend>
                            <asp:Repeater ID="UsersRoleList" runat="server">
                                <ItemTemplate>
                                    <%-- OnCheckedChanged="RoleCheckBox_OnCheckedChanged" --%>
                                    <asp:CheckBox runat="server" ID="RoleCheckBox" Text='<%# Container.DataItem %>' />
                                    <br />
                                </ItemTemplate>
                            </asp:Repeater>
                            &nbsp;
                        </fieldset>
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="head">
    <style type="text/css">
        .style2
        {
            color: red;
        }
        .style3
        {
            width: 187px;
        }
    </style>
</asp:Content>
